c7e485df351f92bdc69d99e758fbd418bbda0965,applications/content/src/org/ofbiz/content/data/DataServices.java,DataServices,updateBinaryFileMethod,#DispatchContext#Map#,638
Before Change
String rootDir = (String)context.get("rootDir");
File file = null;
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, objectInfo:" + objectInfo, module);
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, rootDir:" + rootDir, module);
try {
file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, rootDir);
} catch (FileNotFoundException e) {
Debug.logWarning(e, module);
throw new GenericServiceException(e.getMessage());
} catch (GeneralException e2) {
Debug.logWarning(e2, module);
throw new GenericServiceException(e2.getMessage());
}
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, file:" + file, module);
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, imageData:" + imageData, module);
if (imageData != null && imageData.length > 0) {
try {
FileOutputStream out = new FileOutputStream(file);
out.write(imageData);
if (Debug.infoOn()) Debug.logInfo("in updateBinaryFileMethod, length:" + file.length(), module);
out.close();
} catch (IOException e) {
Debug.logWarning(e, module);
After Change
byte [] imageData = (byte []) context.get("imageData");
String rootDir = (String)context.get("rootDir");
File file = null;
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
Debug.logInfo("in updateBinaryFileMethod, objectInfo:" + objectInfo, module);
Debug.logInfo("in updateBinaryFileMethod, rootDir:" + rootDir, module);
}
try {
file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, rootDir);
} catch (FileNotFoundException e) {
Debug.logWarning(e, module);
throw new GenericServiceException(e.getMessage());
} catch (GeneralException e2) {
Debug.logWarning(e2, module);
throw new GenericServiceException(e2.getMessage());
}
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, file:" + file, module);
Debug.logInfo("in updateBinaryFileMethod, imageData:" + imageData, module);
}
if (imageData != null && imageData.length > 0) {
try {